﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TodoApp.ResultModel;
using TodoApp.TMS_SetUp.Menus;
using TodoApp.TMS_SetUp.Roles;
using Volo.Abp.Application.Services;

namespace TodoApp.TMS_SetUp.TMS_Roles
{
    public class TMS_RoleService: ApplicationService
    {
        private readonly ITMS_RoleRepository _iTMS_RoleRepository;
        public TMS_RoleService(ITMS_RoleRepository tMS_RoleRepository)
        {
            _iTMS_RoleRepository = tMS_RoleRepository;
        }
        /// <summary>
        /// 显示分页
        /// </summary>
        /// <param name="name"></param>
        /// <param name="pageindex"></param>
        /// <param name="pagesize"></param>
        /// <returns></returns>
        public async Task<PageResponse<TMS_RoleDto>> GetRole(string name, int pageindex, int pagesize)
        {
            return await _iTMS_RoleRepository.GetRole(name, pageindex, pagesize);
        }
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public async Task<int> DeleteRole(string id)
        {
            return await _iTMS_RoleRepository.DeleteRole(id);
        }
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="tMS_Role"></param>
        /// <returns></returns>
        public async Task<int> UpdateRole(TMS_RoleDto tMS_Role)
        {
            return await _iTMS_RoleRepository.UpdateRole(tMS_Role);
        }
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="tMS_Role"></param>
        /// <returns></returns>
        public async Task<int> CreateRole(TMS_Role tMS_Role)
        {
            return await _iTMS_RoleRepository.CreateRole(tMS_Role);
        }
        /// <summary>
        /// 显示菜单
        /// </summary>
        /// <returns></returns>
        public async Task<List<TMS_Menus>> GetMenu()
        {
            return await _iTMS_RoleRepository.GetMenu();
        }
        /// <summary>
        /// 添加权限
        /// </summary>
        /// <param name="name"></param>
        /// <param name="ids"></param>
        /// <returns></returns>
        public async Task<ResponseModel<bool>> CreateMenu(string name, string ids)
        {
            return await _iTMS_RoleRepository.CreateMenu(name, ids);
        }
    }
}
